﻿using System;
using System.Collections.Generic;

namespace Pagination
{
    public static class TestHelper
    {
        private static readonly Random Randomizer = new Random(DateTime.Now.Second);

        public static int CreateNumber(int lower, int upper)
        {
            return Randomizer.Next(lower, upper);
        }

        public static char GenerateCharacter()
        {
            return (char)('a' + Randomizer.Next(0, 26));
        }

        public static string CreateString(int length, bool captialised)
        {
            var characters = new List<Char>(length);
            for (var i = 0; i < length; i++)
            {
                if (i == 0 && captialised)
                    characters.Add(char.ToUpper(GenerateCharacter()));

                characters.Add(GenerateCharacter());
            }

            var tmp = new List<string>();
            characters.ForEach(c => tmp.Add(c.ToString()));
            return string.Join("", tmp.ToArray());
        }
    }
}
